package com.ruoyi.account.util;

import java.security.SecureRandom;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class TradetraceUtil {
    private static final SecureRandom random = new SecureRandom();
    private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
    private static final String PREFIX = "3F31";

    public static String buildTradetracePay() {
        return buildRandom("01");

    }

    public static String buildTradetraceRet() {
        return buildRandom("02");
    }

    public static String buildTradetraceSubsidy() {
        return buildRandom("03");

    }

    public static String buildTradetraceAcc() {
        return buildRandom("05");

    }

    public static String buildTradetraceAccSer() {
        return buildRandom("07");

    }

    public static String buildTradetraceAccReg() {
        return buildRandom("09");

    }

    public static String buildTradetraceAccTranche() {
        return buildRandom("11");

    }
    public static String buildTradetraceMemTran() {
        return buildRandom("13");

    }
    public static String buildTradetraceDynamicCode() {
        return buildRandom("15");

    }

    private static String buildRandom(String source) {
        String time = DATE_TIME_FORMATTER.format(LocalDateTime.now());
        String s = time + (int) (random.nextDouble() * 100);
        return PREFIX + source + s;
    }


}
